<template>

  <div style="padding: 10px">
    <div style="width:80%;margin:0 auto;padding: 10px">
      <lable styly="width:150px">专业名称:</lable>
      <el-input v-model="search" aria-placeholder="请输入关键词" style="width: 30%"></el-input>
      <el-button type="primary" style="margin-left: 5px" @click="load">查询</el-button>
    </div>
    <div class="radio1">
      <label>专业类别：</label>

    </div>
    <el-table
      v-loading="loading"
      :data="tableData"
      border
      stripe
      style="width: 80%;margin:0 auto">
      <el-table-column
        prop="mid"
        label="id"
        width="80"
        sortable
      >
      </el-table-column>
      <el-table-column
        prop="mname"
        label="专业">
      </el-table-column>
      <el-table-column
        prop="mcode"
        label="代码">
      </el-table-column>
      <el-table-column
        prop="mintrod"
        label="描述"
      line-hight="100">
      </el-table-column>
      <!--        暂时使用小窗口-->
    </el-table>
    <div style="margin:0 auto;padding-top: 20px;width: 80%">
      <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[5, 10, 20]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="total">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import request from '../utils/request'
export default {
  data () {
    return {
      loading: true,
      search: '',
      radio: 1,
      radio1: '不限',
      currentPage: 1,
      pageSize: 10,
      total: 0,
      tableData: [ ]
    }
  },
  created () {
    this.load()
  },
  methods: {
    load () {
      this.loading = true
      request.get('api/major', {
        params: {
          pageNum: this.currentPage,
          pageSize: this.pageSize,
          search: this.search
        }
      }).then(res => {
        this.loading = false
        this.tableData = res.data.records
        this.total = res.data.total
        console.log(this.search + '11')
      })
    },
    handleCurrentChange (pageNum) {
      this.currentPage = pageNum
      this.load()
    },
    handleSizeChange (pageSize) {
      this.pageSize = pageSize
      this.load()
    }
  }
}
</script>

<style scoped>
.radio{
  width:80%;
  margin: 0 auto;
  padding: 10px;
}
.radio1{
  width:80%;
  margin:0 auto;
  padding:10px
}

</style>
